﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.IO;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ProxyChecker
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        DataTable table = new DataTable();
        List<string> proxies = new List<string>();
        private void Form1_Load(object sender, EventArgs e)
        {
            table.Columns.Add("Proxy");
            table.Columns.Add("Status");
            dataGridView1.DataSource = table;
            DataGridViewColumn column = dataGridView1.Columns[0];
            column.Width = 390;
            DataGridViewColumn column1 = dataGridView1.Columns[1];
            column1.Width = 63;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog();
            dialog.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*";
            dialog.Multiselect = false;
            DialogResult result = dialog.ShowDialog();
            if (result == DialogResult.OK) // Test result.
            {
                try
                {
                    proxies.Clear();
                    table.Clear();
                    proxies.AddRange(File.ReadAllLines(dialog.FileName).Where(l => !string.IsNullOrWhiteSpace(l)));
                    foreach (string s in proxies)
                    {
                        table.Rows.Add(s, "NC");
                    }
                }
                catch
                {

                }
            }
        }
        private void checkProxy()
        {

        }
    }
}
